from script.get_contest_info.response.nc_acm_response import nc_acm_response
import json

# 将返回两个值表示 uid 在 contestid ACM 竞赛中的 AC 次数和罚时
def nc_ac_and_time(contest_id , uid ):
    response = nc_acm_response(contest_id,uid )
    data = json.loads(response)
    if "data" in data and "rankData" in data["data"] and data["data"]["rankData"]:
        first_rank = data["data"]["rankData"][0]
        penalty_time = first_rank["penaltyTime"]
        accepted_count = first_rank["acceptedCount"]
        return  accepted_count , penalty_time
    return 0 , 0

if __name__ == '__main__':
    print(nc_ac_and_time(91283, "807796886"))